<template>
  <div v-if="structData.tabs !== undefined && structData.tabs.length > 0">
    <el-tabs v-model="activeName" :tab-position="tabPosition">
      <el-tab-pane
        v-for="(struct, index) in structData.tabs"
        :key="index"
        :label="struct.structName"
        :name="struct.structId + '-' + struct.structName"
      >
        <template v-if="struct.url !== undefined && struct.url != ''">
          <!-- <component
                      :is="structData.url"
                      :formDate="formData"
                    /> -->
        </template>
        <template v-else>
          <PPMForm :structData="struct" :formData="formData"> </PPMForm>
        </template>
      </el-tab-pane>
    </el-tabs>
  </div>
</template>

<script>
export default {
  name: "ppmTab",
  props: {
    formData: {
      type: Object,
    },
    structData: {
      type: Object,
    },
  },
  data() {
    return {
      //标签方向:top头部,right右边,bottom底部,left左边
      tabPosition:
        this.structData.tabPosition === ""
          ? "top"
          : this.structData.tabPosition,
      activeName: "",
    };
  },
  components: {
    PPMForm: () => import("./ppmForm"),
    //rentList: () => import("./rentList"),
  },
  created() {
    this.load();
  },
  mounted() {
    if (
      this.structData.tabs !== undefined &&
      this.structData.tabs.length >= 1
    ) {
      this.activeName =
        this.structData.tabs[0].structId +
        "-" +
        this.structData.tabs[0].structName;
    }
  },
  methods: {
    load() {
      //验证规则匹配
      if (this.structData.tabs != null && this.structData.tabs.length > 0) {
        this.structData.tabs.forEach((tab) => {
          if (tab.covertName !== undefined && tab.covertName != "") {
            //tab.covertName作为属性调用后台接口，返回tabName,给tab.structName赋值
          }
        });
      }
      // 
    },
  },
};
</script>

<style>
</style>